/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EC;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author TrangNHIT
 */
@Entity
@Table(name = "tbMarket")
@NamedQueries({
    @NamedQuery(name = "Markets.findAll", query = "SELECT m FROM Markets m"),
    @NamedQuery(name = "Markets.findByMarketID", query = "SELECT m FROM Markets m WHERE m.marketID = :marketID"),
    @NamedQuery(name = "Markets.findByMarketName", query = "SELECT m FROM Markets m WHERE m.marketName = :marketName"),
    @NamedQuery(name = "Markets.findByMarketPhoneNumber", query = "SELECT m FROM Markets m WHERE m.marketPhoneNumber = :marketPhoneNumber"),
    @NamedQuery(name = "Markets.findByMartketEmail", query = "SELECT m FROM Markets m WHERE m.martketEmail = :martketEmail"),
    @NamedQuery(name = "Markets.findByMarketAddress", query = "SELECT m FROM Markets m WHERE m.marketAddress = :marketAddress")})
public class Markets implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Market_ID")
    private Integer marketID;
    @Basic(optional = false)
    @Column(name = "Market_Name")
    private String marketName;
    @Basic(optional = false)
    @Column(name = "Market_PhoneNumber")
    private String marketPhoneNumber;
    @Basic(optional = false)
    @Column(name = "Martket_Email")
    private String martketEmail;
    @Basic(optional = false)
    @Column(name = "Market_Address")
    private String marketAddress;
    @JoinColumn(name = "State_ID", referencedColumnName = "State_ID")
    @ManyToOne(optional = false)
    private States states;

    public Markets() {
    }

    public Markets(Integer marketID) {
        this.marketID = marketID;
    }

    public Markets(Integer marketID, String marketName, String marketPhoneNumber, String martketEmail, String marketAddress) {
        this.marketID = marketID;
        this.marketName = marketName;
        this.marketPhoneNumber = marketPhoneNumber;
        this.martketEmail = martketEmail;
        this.marketAddress = marketAddress;
    }

    public Integer getMarketID() {
        return marketID;
    }

    public void setMarketID(Integer marketID) {
        this.marketID = marketID;
    }

    public String getMarketName() {
        return marketName;
    }

    public void setMarketName(String marketName) {
        this.marketName = marketName;
    }

    public String getMarketPhoneNumber() {
        return marketPhoneNumber;
    }

    public void setMarketPhoneNumber(String marketPhoneNumber) {
        this.marketPhoneNumber = marketPhoneNumber;
    }

    public String getMartketEmail() {
        return martketEmail;
    }

    public void setMartketEmail(String martketEmail) {
        this.martketEmail = martketEmail;
    }

    public String getMarketAddress() {
        return marketAddress;
    }

    public void setMarketAddress(String marketAddress) {
        this.marketAddress = marketAddress;
    }

    public States getStates() {
        return states;
    }

    public void setStates(States states) {
        this.states = states;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (marketID != null ? marketID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Markets)) {
            return false;
        }
        Markets other = (Markets) object;
        if ((this.marketID == null && other.marketID != null) || (this.marketID != null && !this.marketID.equals(other.marketID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EC.Markets[marketID=" + marketID + "]";
    }

}
